Apparatus and method for producing a data stream and apparatus and method for reading a data stream

ABSTRACT

An entropy encoder includes an apparatus for producing a data stream which comprises two reference points, of code words of variable lengths, the apparatus comprising a first device for writing at least a part of a code word into the data stream in a first direction of writing, starting from a first reference point, and a second device for writing at least a part of a code word into the data stream in a second direction of writing, which is opposite to the first direction of writing, starting from the other reference point. In particular, when a raster having a plurality of segments is used to write the code words of variable lengths into the data stream, the number of the code words which can be written starting at raster points is doubled, in the best case, such that the data stream of code words of variable lengths is robust toward a propagation of sequence errors.

FIELD OF THE INVENTION

The present invention relates to encoding with code words of variablelengths and, in particular, to producing and reading data streams withcode words of variable lengths, which are robust with regard to errorsin transmission.

BACKGROUND OF THE INVENTION AND PRIOR ART

Modern audio encoding or decoding methods which work by the MPEG layer 3standard, for example, are capable of compressing the data rate of audiosignals, e.g. by a factor 12, without noticeably degrading the qualitythereof. In order to achieve such a high data rate reduction, an audiosignal is sampled, whereby a sequence of discrete-time samples isobtained. As is known in the art, the sequence of discrete-time samplesis windowed in order to obtain windowed blocks of time samples. A blockof time-windowed samples is then transformed to the frequency range bymeans of a filter bank, a modified discrete cosine transform (MDCT) orother suitable device, in order to obtain spectral values which, as awhole, represent the audio signal, i.e. the time section determined bythe block of discrete-time samples, in the frequency range. Usually,time blocks which overlap at 50% are produced and transformed to thefrequency range by means of a MDCT whereby, due to the specificproperties of the MDCT, 1024 discrete-time samples, for example, alwayslead to 1024 spectral values.

It is known that the receptivity of the human ear depends on themomentary spectrum of the audio signal itself. This dependency iscovered in the so-called psycho-acoustic model by means of which it hasbeen possible for quite some time to calculate masking thresholdsdepending on the momentary spectrum. Masking means that a specific toneor a spectral component is hidden in case an adjacent spectral range,for example, has relatively high energy. This fact of masking isutilized in order to quantize as closely as possible the spectral valuespresent after the transformation. The aim is therefore to avoid audibleinterferences in the re-decoded audio signal on the one hand and to useas few bits as possible on the other hand in order to encode or, in thiscase, to quantize the audio signal. The interferences introduced byquantization, i.e. quantization noise, are intended to be below themasking threshold and, therefore, to be inaudible. In accordance withknown methods, a classification of the spectral values in so-calledscale factor bands is carried out, which should correspond to thecritical bands, i.e. frequency groups, of the human ear. Spectral valuesin a scale factor group are multiplied by a scale factor in order tocarry out overall scaling of spectral values of a scale factor band. Thescale factor bands scaled by the scale factor are then quantized,whereupon quantized spectral values are produced. It is understood thatgrouping in scale factor bands is not critical. However, it is used inthe MPEG layer 3 standards or in the MPEG 2 AAC standard (AAC=advancedaudio coding).

A very essential aspect of data reduction lies in entropy encoding ofthe quantized spectral values, which follows quantizing. Huffmanencoding is usually used for entropy encoding. A Huffman coding isunderstood to mean a coding with a variable length, i.e. the length ofthe code word for a value to be encoded is dependent on the probabilityof occurrence thereof. Logically, the most probable character isassigned the shortest code, i.e. the shortest code word, so that verygood redundancy reduction can be achieved by means of Huffman encoding.An example for a generally-known coding with a general length is theMorse code.

In the field of audio encoding, Huffman codes are used for encoding thequantized spectral values. A modern audio encoder, which works, forexample, in accordance with the MPEG 2 AAC standard, uses differentHuffman code tables for encoding the quantized spectral values, whichHuffman code tables are assigned to the spectrum by certain criteria ona section-by-section basis. In this process, 2 or 4 spectral values arealways encoded together in one code word.

One difference between the method in accordance with MPEG 2 AAC and themethod in accordance with MPEG layer 3 is that different scale factorbands, i.e. different spectral values, are grouped into any number ofspectral sections. With AAC, one spectral section includes at least fourspectral values, but preferably more than four spectral values. Theentire frequency range of the spectral values is therefore divided upinto adjacent sections, with one section representing one frequency bandsuch that all sections together cover the entire frequency range, whichis superimposed by the spectral values after the transformation thereof.

As in the MPEG layer 3 method, one section is assigned to a so-called“Huffman table” from a plurality of such tables in order to achieve amaximum redundancy reduction. In the bit stream of the AAC method, whichusually comprises 1024 spectral values, are now the Huffman code wordsfor the spectral values in an ascending order of frequencies. Theinformation on the table used in each frequency section is transferredin the side information. This situation is shown in FIG. 6.

FIG. 6 shows the exemplary case where the bit stream includes 10 Huffmancode words. In case one code word is always formed from one spectralvalue, 10 spectral values may be encoded here. However, usually 2 or 4spectral values are always jointly encoded by one code word, which iswhy FIG. 6 shows a part of the encoded bit stream which includes 20 or40 spectral values. In the case where each Huffman code word includes 2spectral values, the code word designated by No. 1 represents the firsttwo spectral values, with the length of code word No. 1 being relativelyshort, which means that the values of the first two spectral values,i.e. of the two smallest frequency coefficients, occur relativelyfrequently. The code word bearing the No. 2, however, has a relativelylong length, which means that the amounts of the 3^(rd) and 4^(th)spectral coefficients in the encoded audio signal are relatively rare,which is why they are encoded with a relatively large amount of bits.Further, it is apparent from FIG. 6 that the code words with the numbers3, 4 and 5, which represent the spectral coefficients 5 and 6 or 7 and 8or 9 and 10, also occur relatively frequently, since the length of theindividual code words is relatively small. The same applies to the codewords bearing the numbers 6 to 10.

As has already been mentioned, it is clearly apparent from FIG. 6 thatthe Huffman code words for the encoded spectral values are arranged inthe bit stream in a linearly ascending manner with regard to thefrequency in case a bit stream which is produced by a known encodingapparatus is considered.

One major drawback with regard to Huffman codes, in the case of faultychannels, is error propagation. It may be assumed, for example, thatcode word No. 2 in FIG. 6 is interfered with. There is a certain, notlow, probability that the length of this wrong code word No. 2 is alsomodified. It therefore is different from the correct length. In case, inthe example of FIG. 6, code word No. 2 has been modified in its lengthdue to an interference, it is no longer possible for an encoder todetermine the starts of the code words 3 to 10, i.e. of almost theentire audio signal represented. This means that all other code wordsfollowing the code word which has been interfered with can no longer becorrectly encoded, since it is not known where these code words start,and since an incorrect starting point was selected due to the error.

As a solution to the problem of error propagation, European Patent No. 0612 156 proposes that a part of the code words of variable lengths bearranged in a raster and that the remaining code words be distributed inthe remaining gaps, so that the start of a code word which is arrangedat a raster point can be more easily found without full decoding or inthe case of an incorrect transmission.

It is true that the known method provides some remedy for errorpropagation by means of rearranging the code words. For some code words,a fixed location in the bit stream is agreed upon, whereas the remaininggaps are available for the remaining code words. This does not cost anyadditional bits, but prevents, in the case of an error, errorpropagation among the rearranged code words.

German Patent Application 19 747 119.6-31, which was published after thefiling date of the present application, proposes that not just any codewords be located at raster points, but that code words which aresignificant from a psycho-acoustic point of view, i.e. code words forspectral values which make a significant contribution to the audiosignal, be located at raster points. A data stream with code words ofvariable lengths, such as is produced by such an encoder, is shown inFIG. 5. As in FIG. 6, the data stream also includes 10 code words, withthe priority code words being shaded. The first priority code word islocated such as to start at a first rater point 100, the second prioritycode word is located such as to start at a second raster point 101, thethird priority code word is located such as to start at a third rasterpoint 102, the fourth priority code word is located such as to start ata fourth raster point 103 and the fifth priority code word is locatedsuch as to start at a fifth raster point 104. A first segment 105 isdefined by the raster points 100 and 101. Similarly, a second 106, athird 107, a fourth 108 and a final segment 109 are defined. It is shownin FIG. 5 that the first two segments 105 and 106 have a differentlength from the two segments 107 and 108 and yet a different length fromthe final segment 109. Non-priority code words 6, 7, 8, 9 and 10 arethen entered in the data stream following the priority code words suchthat the latter is filled up, so to speak. As is shown in FIG. 5, in thepost-published method, the non-priority code words are consecutivelyinserted in the raster after the priority code words have been written.Specifically, the non-priority code word No. 6 is entered following then on-priority code word 1. The space still remaining in the segment 105is filled up with the following non-priority code word 7, with theremainder of the non-priority code word 7, i.e. 7 b, being written inthe next free space, i.e. in the segment 107, directly following thepriority code word 3. The same procedure is followed for thenon-priority code words 8 to 10.

The advantage of the post-published method illustrated in FIG. 5 is thatthe priority code words 1 to 5 are protected against error propagation,since their starting points coincide with raster points and aretherefore known.

In case, for example, the priority code word 2 has been damaged intransmission, it is very likely in the prior art shown in FIG. 6 that adecoder will not be able to decode any of the remaining code words 3 to10 correctly. In the method shown in FIG. 5, however, the next codeword, i.e. priority code word 3, starts at the raster point 102 suchthat the decoder will, at any rate, find the correct start of code word3. Therefore, in the method shown in FIG. 5, no sequence errorwhatsoever will occur, and only priority code word No. 2 will bedamaged. Consequently, this method provides effective protection forpriority code words which are located at raster points.

However, there is no effective protection for non-priority code words.Referring to FIG. 5, damaging the non-priority code word No. 6 such thatthe decoder assumes, as an incorrect code word No. 6, a code word whichis one bit shorter, will result in the fact that it is also no longerpossible to correctly decode code word No. 7, since the last bit of thecorrect code word No. 6 is interpreted as being the start of the nextcode word No. 7. Therefore, an error in code word No. 6 will lead to thefact that, at a very high probability, it will no longer be possible,due to a sequence error, to correctly decode any code words following iteven in case they have not been adversely affected by a transmissionerror.

DE 691 26 565 T2 relates to a method for transmitting codes of variablelengths. By this method, a data stream is produced in which, startingfrom the start of the data stream, code words of variable lengths arewritten in a first direction up to a certain point in the data stream.However, in order to increase error robustness, not the entire datastream is written in one direction, but merely up to the predeterminedpoint. From the end of the data stream, the remainder of the code wordsof variable lengths is then written in an opposite direction of writingup to the predetermined point, so that a data stream results whose firsthalf comprises code words which are written in the forward direction andwhose second half comprises code words which are written in the backwarddirection.

U.S. Pat. No. 5,852,469 relates to encoding and decoding systems forcode words with variable lengths and code words with specified lengths.It is provided, for code words with specified lengths, to providesynchronous positions in the data stream whose distance is equal to thelength of the code words of specified lengths. The code words are thenentered into the data stream such that they all start at a synchronousposition. For code words of variable lengths, a data stream with a startand an end, however without synchronous positions, is provided in orderto enter code words of variable lengths in the forward direction,starting from the start of the data stream up to a certain positionbehind the center of the data stream. Starting from the end of the datastream up to the predetermined position in the center, code words ofvariable lengths are then entered in the opposite direction of writing.

SUMMARY OF THE INVENTION

It is the object of the present invention to render code words ofvariable lengths more error-robust.

In accordance with a first aspect of the present invention, this objectis achieved by an apparatus for producing a data stream, which comprisesa multitude of raster points as reference points, the raster pointsspecifying a raster, two adjacent raster points defining a segment, ofcode words of variable lengths which are divided up into a plurality ofsets of code words, the apparatus comprising: a first device for writingat least a part of each code word of a first set of code words into thedata stream in a first direction of writing, starting at a first rasterpoint of a segment, respectively; a second device for writing at least apart of a code word of a second set of code words into the data streamin a second direction of writing, which is opposite to the firstdirection of writing, starting from a second raster point, respectively,the code words of the second set being assigned to segments inaccordance with a predetermined assignment rule, such that each codeword of the second set is assigned to a different segment, wherein, incase that a code word of the second set does not or not completely fitinto the assigned segment, at least a part of this code word or at leasta part of the remainder of this code word which does not fit into theassigned segment is written into a different, not fully occupiedsegment, in accordance with a predetermined rule, by the first device orthe second device, after the second device for writing has processed allremaining segments with the other code words of the second set.

In accordance with a second aspect of the present invention, this objectis achieved by an apparatus for reading a data stream which comprises amultitude of raster points as reference points, the raster pointsspecifying a raster, two adjacent raster points defining a segment,wherein the data stream comprises a plurality of sets of code words, afirst set of code words being written in the first direction and asecond set of code words being written in a second direction, the codewords of the second set being assigned to segments of the data stream inaccordance with a predetermined assignment rule, such that each codeword of a set being assigned to a different segment, wherein a code wordof the second set may be divided up over more than one segment inaccordance with a predetermined rule, the apparatus comprising thefollowing: a first apparatus for reading in a first direction of readingwhich corresponds to the first direction of writing; a second device forreading in a second direction of reading which is opposite to the firstdirection of reading; and a control device for supplying the code wordsof the first set to the first reading device, each code word of thefirst set starting at the first raster point of a segment, and forsupplying the code words of the second set to the second reading device,wherein one jumps to the second raster point of a segment in accordancewith the predetermined assignment rule, and wherein, after all segmentshave been searched for code words of the second set and at least onecode word of the second set is not present or not complete, one jumps atleast to one further segment in accordance with the predetermined rulein order to obtain the at least one code word of the second setcompletely or a part of the at least one code word.

In accordance with a third aspect of the present invention, this objectis achieved by a method for producing a data stream, which comprises amultitude of raster points (41-47) as reference points, the rasterpoints specifying a raster, two adjacent raster points defining asegment, of code words of variable lengths, which are divided up into aplurality of sets of code words, the method comprising the followingsteps: writing at least a part of each code word of a first set of codewords into the data stream in a first direction of writing, startingfrom a first raster point of a segment, respectively; writing at least apart of a code word of a second set of code words into the data streamin a second direction of writing which is opposite to the firstdirection of writing, starting from a second raster point of a segment,respectively, the code words of the second set being assigned tosegments in accordance with the predetermined assignment rule, such thateach code word of the second set is assigned to a different segment,wherein, in case a code word of the second set does not or notcompletely fit into the assigned segment, at least a part of this codeword or at least a part of the remainder of this code word which doesnot fit into the assigned segment is written into a different, not fullyoccupied segment in the first or second direction of writing, inaccordance with a predetermined regulation, after all remaining segmentshave been processed with the other code words of the second set.

In accordance with a fourth aspect of the present invention, this objectis achieved by a method for reading a data stream which comprises amultitude of raster points as reference points, the raster pointsspecifying a raster, two adjacent raster points defining a segment, inwhich method the data stream comprises a plurality of sets of codewords, a first set of code words being written in the first directionand a second set of code words being written in a second direction, thecode words of the second set being assigned to segments of the datastream in accordance with a predetermined assignment rule, such thateach code word of a set is assigned to a different segment, wherein acode word of the second set may be divided up over more than one segmentin accordance with a predetermined regulation, the method comprising thefollowing steps: reading the code words of the first set, starting froma first raster point of a segment, in a first direction of reading whichcorresponds to the first direction of writing; reading the code words ofthe second set, starting from a second raster point of a segment, in asecond direction of reading which is opposite to the first direction ofreading wherein it is jumped, for reading the code words of the secondset, to the second raster point of a segment in accordance with thepredetermined assignment rule, wherein, after all segments have beensearched for code words of the second set or at least a code word of thesecond set is not present or not completely present, one jumps to atleast one further segment in accordance with the predetermined rule soas to obtain the at least one code word of the second set completely ora part of the at least one code word.

The present invention is based on the realization that the robustness ofa data stream toward transmission errors and, in particular, towardsequence errors with code words of variable lengths can be decisivelyincreased when the data stream is not written only in one direction ofwriting but is written, additionally, in the other direction of writing.In the most general case, a data stream will always have a start and anend. In the prior art, in the simplest case, the data stream was writtenonto, starting from the starting point, until it was completed. Therebyit was possible that a transmission error in the first code word couldresult in that the entire data stream could no longer be decodedcorrectly, even if all other code words were transmitted correctly. Inaccordance with the invention, such a data stream may be written suchthat the first half of the data stream is written starting from thestart of the data stream, whereas the second half of the data stream iswritten starting from the end of the data stream. Even from this simpleexample, it can be seen that a transmission error in the first half ofthe data stream no longer has the effect that code words of the seconddata stream can also no longer be decoded correctly due to sequenceerrors. This is the case because the decoder knows that after half ofthe data stream it must continue reading starting from the end of thedata stream, to be precise in the opposite direction of reading. Thus, acertain error robustness is obtained merely due to reversing thedirection of writing/the direction of reading with virtually no extraeffort.

As has already been mentioned, code words with variable lengths arewritten into a data stream using raster points such that a decoder candecode with a limited number of sequence errors since, by definition,certain code words start at raster points. For maximum error robustness,it will, in principle, be desirable to have a raster which is as narrowas possible, such that a decoder can find the correct starting points ofas many code words as possible. On the other hand, an increase in thenumber of raster points, i.e. a reduction of the segment length, willresult in that fewer and fewer code words which, as is known, havevariable lengths, completely fit into the raster, which is why measuresare taken for the end sections of the same to be written into othersegments in order to be able to be detected correctly in decoding. Thisleads to an increasing additional effort with a raising number of rasterpoints and with a reduction in the segment length.

In the prior art, code words were written merely in one single directionof writing, starting from a raster point, as has been explained withreference to FIGS. 5 and 6. In accordance with the invention, code wordsare now also written in the opposite direction of writing, starting fromraster points, which causes the number of the code words which can bewritten starting at raster points to double, in the best case,essentially without any additional effort. By writing the data stream bymeans of a device for writing in a first direction of writing startingfrom a reference point and by means of a second device for writing in asecond direction of writing which is opposite to the first direction ofwriting, starting from a different reference point, it becomes possibleto not only utilize “one side” of a reference point, but both sides of areference point for error robustness, i.e. for protection againstpropagation or sequence errors. Depending on the form of implementation,every other code word can be written in the same direction, for example,and every remaining code word can be written in the other direction. Onthe other hand, the code words of variable lengths can be divided upinto different sets of code words, for example in accordance with theirpriority, such that, for example, all code words of the first set arewritten in the first direction of writing, starting at raster points,and all code words of the second set can be written in the seconddirection of writing, starting at raster points.

In addition, remainders of code words may be written in the samedirection of writing as the starting sections of the code words or,alternatively, in the opposite direction of writing. It is evident thatmeasures must be taken in order for a decoder, i.e. an apparatus forreading the data stream, to always be fully aware of which direction ofwriting has been used in writing. This may either be specifically set orbe transmitted as side information to the data stream of code words ofvariable lengths. The same applies also to the segment lengths, whereinthe segment length may either be equal or vary over the entire datastream, wherein the current segment length can of course also bespecifically set in a decoder or can be transmitted via side informationtogether with the code words of variable lengths.

BRIEF DESCRIPTION OF THE DRAWINGS

Preferred embodiments of the present invention will be explained indetail below with reference to the attached drawings, in which:

FIG. 1 shows an inventive apparatus for writing an error-robust datastream;

FIG. 2 shows an inventive apparatus for reading an error-robust datastream;

FIGS. 3-3A show a procedural diagram of the inventive method by means ofthree sets of code words of variable lengths;

FIGS. 4-4A show a procedural diagram for illustrating the inventivemethod for reading a data stream which has been produced in accordancewith FIG. 3 and 3A;

FIG. 5 shows a data stream which is produced by a known apparatus and inwhich the priority code words are exposed to error propagation;

FIG. 6 shows a data stream in which sorting by priority code words andnon-priority code words has been carried out.

DETAILED DESCRIPTION OF PREFERRED EMBODIMENTS

Before FIG. 1 will be described in more detail, it should be noted thatencoding with code words of variable lengths is also referred to asentropy encoding in the art. One representative example of entropyencoding is the so-called Huffman encoding. In principle, in Huffmanencoding, the information symbols to be encoded are statisticallyexamined in order to determine shorter code words for the informationsymbols occurring more frequently than for information symbols occurringless frequently. In a complete Huffman code, all code words areterminated ends or branches of a code tree. For example, a Huffmandecoder serially reads in a data stream with Huffman code words and, putgraphically, jumps to a branching of the specified code tree with eachbit that it reads in additionally until, after a certain number ofjumps, which corresponds to the number of bits of the code word, i.e. tothe length of the code word, it arrives at a branch end which does nothave any further branching and is therefore a code word. The decoderthen knows that a new code word starts with the next bit. This processis repeated as often as required until the data stream has beencompletely read in. With each time that the Huffman encoder jumps backto the starting point, i.e. to the root of the tree, a code word ispresent at its point of origin. Since the lengths of the code words areimplicitly specified by the code words themselves or by the code treeknown in the encoder and in the decoder, it can be seen that aninterference in the data stream which leads to a reversal of a bitmisleads the decoder in the code tree, so to speak such that it ends upwith a different code word, i.e. an incorrect code word, which is verylikely to have a different length from the correct code word. In thiscase, the decoder will, once it has arrived at the incorrect code word,jump back and, due to the bits then following, again move from onebranching point to another in the code tree. However, it is not possiblefor the decoder to avoid a sequence error, unless it coincidentally endsup on the “correct track”.

Therefore, error protection, as is provided by the present invention,must be performed in order to ensure error-robust transmission. Theapparatus for producing a data stream of code words of variable lengthsin accordance with the present invention may therefore act as a sendingor output stage of a Huffman encoder, as it were, whereas the apparatusfor reading a data stream of code words of variable lengths may act as areceiving or input stage of a Huffman encoder. It can be seen from thisthat the present invention is not only applicable to Huffman encoders,but to any code having code words of variable lengths which issusceptible to sequence errors.

FIG. 1 shows an apparatus 10 in accordance with the invention forproducing an error-robust data stream at an output 12, when code wordsof variable lengths are input into the apparatus 10 at an input 14. Theapparatus includes a first device 16 for writing in a first direction ofwriting, starting from a first reference point, and a second device 18for writing in a second direction of writing, starting from a secondreference point. Depending on the complexity of the apparatus 10, thecode words of variable lengths may both be applied to both devices 16and 18 for writing, as is illustrated in FIG. 1 by a simple branchingpoint 20 and a corresponding combination point 22. The selection as towhich code words are written in which direction, and/or as to whichsections of code words are written in which direction, would then bemade by devices 16 and 18. Instead of the node 20, a demultiplexer maybe present alternatively, which supplies certain code words, for examplecode words of a set of code words, to the first device 16, and suppliescertain code words to the second device 18. By analogy therewith, thecombination point 22 would then be implemented by a multiplexermultiplexing the error-robust data stream 12. Other devices, which wouldbe controlled correspondingly, for supplying the two devices 16 and 18with the code words of variable lengths are apparent for those skilledin the art in view of the present description.

An apparatus 30 for reading an error-robust data stream, which apparatusis complementary to the apparatus 10 for producing a data stream, shownin FIG. 1, is shown in FIG. 2. Apparatus 30 includes an input 32, wherethe error-robust data stream is entered after transmission via a radiolink for example, in order to obtain, again, at a starting point 34, thecode words of variable lengths which have been fed into the input 14 ofthe apparatus 10 in FIG. 1. Apparatus 30 for reading the data streamincludes a first device 36 for reading in the first direction, startingfrom the first reference point, and a second device 38 for reading thedata stream in the second direction, starting from a second referencepoint.

It is evident that apparatus 30 also contains a branching point 40 and acombination point 42, the feeding-in of the error-robust data streaminto the two devices 36 and 38 taking place, for example, based on aspecifically set algorithm or based on side information which may alsobe transmitted, together with the error-robust data stream, from thesender, i.e. the apparatus 10 in FIG. 1, to the receiver, i.e. theapparatus 30 in FIG. 2.

FIGS. 3 and 3A illustrate, by means of an example, the inventive methodfor writing code words of variable lengths. In the example, there are 15code words of variable lengths 30 which are preferably divided up into afirst set having 6 code words 1 to 6, into a second set also having 6code words 7 to 12 and into a third set having the remaining 3 codewords 13 to 15. As is shown in FIG. 3, code words 30 have variablelengths.

In accordance with a preferred embodiment of the present invention, thesegment length, i.e. the length of the segment, is longer than thelength of the longest code word of the first set. The code words of thefirst set are arranged at raster points 41 to 46, wherein, for the lastsegment No. 6, a raster point is indicated by a dotted line, whichraster point is not used, however, since the end 47 of the data streamcan also be considered as a raster point as it were and since the rasterpoint indicated by a dotted line is thus superfluous. The first segmentNo. 6 is therefore longer than the other segments, which is completelyirrelevant for the present invention, however. Generally speaking, thesegments may have any lengths, which change within the data stream, itbeing understood that the current length of a segment must be known tothe decoder so that the inventive advantages can be utilized.

Firstly, the code words of the first set are written into the datastream in a step a), which results in a fragmentary data streamindicated by 31, in which the code words of the first set are writteninto a respective segment from left to right, as is indicated by arrows48 which are to symbolize the direction of writing in the entire FIG. 3.Since the segment length is selected to be longer than the longestlength of a code word of the first set, only one single attempt isneeded for step a). In case the segments are shorter, more attempts maybe required accordingly.

Now the code words of the second set are written into the data stream 31in a step b). In order to achieve high error robustness, the code wordsof the second set are not written from left to right like the code wordsof the first set, but are written from right to left, starting from thesecond raster point, respectively, e.g. the raster point 42 for thefirst segment, as is indicated by the respective arrow of writingdirection. The writing of the code words of the second set takes placein accordance with a predetermined assignment rule which says, in theexample selected, that the first code word of the second set is to bewritten in the same segment as the first code word of the first set,however always on the condition that there is still room in thissegment. The data stream 32 resulting from the first attempt shows thatin the first segment there was only so much room for writing thestarting section of code word No. 7.

In contrast to the prior art, where the second part of code word No. 7would have been written into the second segment, the second half of codeword No. 7, i.e. 7 b), is stored for writing it into the data stream ina second attempt in accordance with a predetermined regulation, i.e. inaccordance with an regulation which must also be known to the decoder.FIGS. 3 and 3A clearly show that in the second segment, there was stillenough room between code word Nos. 2 and 8 for the final section of codeword No. 7 to be entered. In case there had not been enough room, thethird section of the code word would have been entered into segment No.3. Thus, in FIGS. 3 and 3A, the predetermined regulation for enteringcode word No. 7 into the data stream consists in proceeding by onesegment in each case. Of course, one may also proceed by two segments orby three or more, such that, as a consequence, the second segment 7 b)could then be written, instead of the second segment, into the third,into the fifth in the next attempt, etc. The order of segments which isused to accommodate the second part of section 7 somewhere is arbitrary.However, it must be transparent to the decoder so that the re-sorteddata stream can be re-read.

The code words of the third set 13 to 15 are now to be entered into theresulting data stream 33, which is also still fragmentary. By analogywith step b), this is done preferably by the same assignment rule suchthat the first code word of the third set is assigned to the firstsegment, that the second code word of the third set is assigned to thesecond segment, that the third code word of the third set is assigned tothe third segment, etc. This assignment rule is entirely arbitrary forthe third set and may also be different from the assignment rule for thesecond set, with each code word of a set being assigned to a differentsegment in accordance with the invention. Similarly, the direction ofwriting can also be selected arbitrarily for each set. Preferably, analternating writing direction order is used. Alternatively, however, itis also possible to write two adjacent sets using the same direction ofwriting. In principle, the writing direction may also altered within aset.

The first attempt in step c) was successful only in that the firstsection of code word No. 15 was entered, resulting in a fragmentary datastream 34. Code words 13, 14 and the second section of code word 15,i.e. 15 b) are stored for being accommodated in the second, third,fourth, fifth and sixth attempts, wherein the second section 15 b couldbe accommodated in the fourth segment in the second attempt (data stream35), wherein nothing could be accommodated in the third attempt, whereinthe starting section of code word 14 could be accommodated in the fourthattempt (data stream 36), wherein the final section of code word 14,i.e. 14 b could be accommodated in the fifth attempt (data stream 37)and wherein, finally, the first code word of the third set could beentered in the sixth segment in the sixth and final attempt, whichresults in the error-robust data stream 38 for the example illustratedhere. The method described using FIGS. 3 and 3A ensure that the lengthof the error-robust data stream exactly corresponds to the sum of thelengths of the code words of variable lengths, which is self-evident forthe purposes of entropy encoding for data reduction. However, thepresent invention is not limited to the error-robust data stream havingthe minimal length, since error robustness is not affected by any fillerbits that may be present.

When looking at the robust data stream shown in FIG. 3A, it can be seenthat the start of code word No. 8, i.e. raster point 43, is entirelyindependent of the end of code word No. 7. Moreover, the start of codeword No. 9, i.e. raster point 44, is entirely independent of the end ofcode word No. 8. Additionally, it should be noted that due to theopposite writing order, a data error in code word No. 1 in the firstsegment, for example, which leads to the fact that the incorrect codeword is one bit shorter than the correct code word No. 1 due to the dataerror, does not lead to a destruction of the starting section of codeword No. 7 a, since the latter was written from right to left instead offrom left to right. In case it had been written from left to right, adecoder would take the remaining bit from the initially correct codeword No. 1 as the starting bit of code word No. 7, which would result ina sequence error from 1 to 7. However, this sequence error would notpropagate to 8, since code word No. 8, again, is entirely independent ofcode word No. 7, since the writing order was chosen to be from right toleft. In case the writing order of code word No. 8 is equal to thewriting order of the code words of the first set, the error would notpropagate from 7 to 8 either, since code word No. 8 would be writtenadjacent to code word No. 2 before the second part 7 b due to theassignment rule and is, therefore, not influenced by an incorrectsection 7 b.

By means of an appropriate example, FIGS. 4 and 4A show the operation ofthe apparatus for reading the error-robust data stream 38. Initially,the code words of the first set are extracted from the error-robust datastream in step a). For this purpose, the inventive apparatus, which maybe coupled to a Huffman decoder, reads the code word of the first setstarting from the first raster point 41, reads code word No. 2 of thefirst set starting from the second raster point 42, etc., until all codewords 1 to 6 of the first set have been read in. It is self-evident thatthe apparatus for reading the data stream selects the same direction ashas been used by the apparatus for producing.

Subsequently, the code words of the second set are extracted from theremaining data stream 50 in step b). Here, the decoder jumps to thesecond raster point 42 of the first segment and obtains the startingsection of code word 7 of the second set (the first segment is nowempty), whereupon it does not read in the second section 7 b, but 7 a isfirst stored in order to then read in the second code word of the secondset starting from the second raster point of the second segment, etc.The result is a residual data stream 51 in which the first segment hasbeen completely emptied. Since the decoder does not now read the codeword 7 continuously, but always reads segment by segment on the basis ofthe assignment rule used for the apparatus for producing the datastream, the error robustness which has already been described and whichstrongly reduces propagation of sequence errors is ensured.

In a second attempt for extracting the code words of the second set, thesecond part of code word 7 b is now read in the second segment inaccordance with the existing writing direction, whereupon only codewords of the third set remain in the resulting data stream 52, and thesecond segment is empty. These are extracted in step c), wherein thestarting section of code word 15 has been initially determined in afirst attempt, which is not stored however, since code word 15 has notbeen found complete in the third segment. The third segment is nowempty. In a second attempt, code word 15 can be found complete. However,the search for code word 14 in segment 3 and for code word 15 in segment14 remained without success, which can be seen by the data stream 54.Nevertheless, in the fourth attempt, the search for code word 14 in thefifth segment lead to a positive result. However, code word 14 was notcomplete, which is why the starting section 14 a was stored in order toexamine the remaining data stream 55 in a fifth attempt and to fullyread in, in a final sixth attempt, data stream 56, which now onlyconsists of the sixth segment and of code word 13.

Even though in the previous example merely a division of code words intoa starting section and a final section was illustrated by way ofexample, any type of division is possible in principle. Error-robustdecoding will be ensured as long as the decoder observes the assignmentof code words of the second set or of the third set and of further setsto different segments, respectively. Moreover, it is obvious that thesorting of the final sections of code words into the data stream isarbitrary as long as the decoder or the read-in circuit upstream of thedecoder knows exactly which predetermined regulation has been carriedout in the encoder.

In order to once again underline the advantages and/or the operation ofthe present invention, reference is made to the error-robust data streamNo. 38 of FIG. 3A. When looking at the first segment between the rasterpoints 41 and 42, it can be seen that code word No. 1 is written fromleft to right, starting from the first raster point 41, as is clearlyindicated by the arrow drawn underneath. The first part of code word No.7, i.e. 7 a, however, is written from right to left, starting from thesecond raster point 42. If both code words No. 1 and No. 7 or 7 a werewritten into the data stream only from left to right, the start of codeword 7 or the starting point of the starting section 7 a of code word 7would depend on the end of code word 1. Therefore, a transmission errorin code word 1 would almost inevitably also lead to a sequence error incode word 7. However, if code word 7 is written in the oppositedirection of writing, starting from the second raster point 42, inaccordance with the invention, the starting point of code word 7 or ofstarting section 7 a of code word 7 no longer depends on code word 1 butis determined by the raster or raster point 42. A decoder will alwaysknow this starting point, which is why an error in code word 1 will notlead to an error in code word 7. It can be seen from the error-robustdata stream 38 of FIG. 3 that the first section 7 a and the secondsection 7 b of code word No. 7 are both written in the same direction ofwriting. However, this is not compulsory. Of course, the second section7 b of code word 7 may also be written from left to right and would thenstart at the end of the second code word No. 2.

If the raster points are chosen such that the segment lengths are longerthan the longest length of a code word of the first set, no segment willbe filled in completely by the code word of the first set, as can beseen, for example, from the data stream 31 of FIG. 3. In this case, thenumber of code words which can be written starting at raster points isactually doubled without there being any need of providing one singleadditional raster point.

1. Apparatus for reading a data stream, which comprises a multitude ofraster points as reference points, the raster points specifying araster, two adjacent raster points defining a segment, wherein the datastream comprises a plurality of sets of code words, a first set of codewords being written in the first direction and a second set of codewords being written in a second direction, the code words of the secondset being assigned to segments of the data stream in accordance with apredetermined assignment rule, such that each code word of a set beingassigned to a different segment, wherein a code word of the second setis distributed over more than one segment in accordance with apredetermined rule, the apparatus comprising: a first device for readingin a first direction of reading which corresponds to the first directionof writing; a second device for reading in a second direction of readingwhich is opposite to the first direction of reading; and a controldevice for supplying the code words of the first set to the firstreading device, each code word of the first set starting at the firstraster point of a segment, and for supplying the code words of thesecond set to the second reading device, wherein one jumps to the secondraster point of a segment in accordance with the predeterminedassignment rule, and wherein the control device is adapted for jumpingat least to a further segment different from the segment, in which thepart of the code word of the second set has been found, in accordancewith the predetermined rule, when all segments have been searched forcode words of the second set in accordance with the predeterminedassignment rule and at least only a part of the code word of the secondset has been found in a segment and the code word of the second set isstill not complete, and wherein the control device is adapted forobtaining the at least one codes word of the second set completely or afurther part of the at least one code word of the second set from thefurther segment; and a decoder for decoding the code words of the firstset and the code words of the second set to obtain a decoded signal. 2.Apparatus as claimed in claim 1, wherein, if only one starting sectionof a code word is read by a writing device in one segment, this startingsection is stored.
 3. Apparatus as claimed in claim 1, wherein the codewords are Huffman code words.
 4. Apparatus as claimed in claim 1,wherein the code words represent information symbols and wherein codewords of the first set represent more significant information symbolsthan code words of the second set or of further sets.
 5. Apparatus asclaimed in claim 4, wherein the information symbols are spectral valuesof an audio signal, and wherein the code words of the first set arespectral values which are significant from a psycho-acoustic point ofview and which are to be protected from error propagation due to atransmission error in the data stream.
 6. Method for reading a datastream which comprises a multitude of raster points as reference points,the raster points specifying a raster, two adjacent raster pointsdefining a segment, in which method the data stream comprises aplurality of sets of code words, a first set of code words being writtenin the first direction and a second set of code words being written in asecond direction, the code words of the second set being assigned tosegments of the data stream in accordance with a predeterminedassignment rule, such that each code word of a set is assigned to adifferent segment, wherein a code word of the second set is distributedover more than one segment in accordance with a predeterminedregulation, the method comprising: reading the code words of the firstset, starting from a first raster point of a segment, in a firstdirection of reading which corresponds to the first direction ofwriting; reading the code words of the second set, starting from asecond raster point of a segment, in a second direction of reading whichis opposite to the first direction of reading, wherein it is jumped, forreading the code words of the second set, to the second raster point ofa segment in accordance with the predetermined assignment rule, and whenall segments have been searched for code words of the second set inaccordance with the predetermined assignment rule and only a part of thecode word of the second set has been found in a segment and the codeword of the second set is still not complete, jumping to at least onefurther segment different from the segment, in which the part of thecode word of the second set has been found, in accordance with thepredetermined rule, and obtaining the at least one code word of thesecond set completely or a part of the at least one code word from thefurther segment; and decoding the code words of the first set and thecode words of the second set to obtain a decoded signal.